home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $FilesInOrderTest < prev    next >
Encoding:
Text File  |  1991-12-01  |  1.6 KB  |  37 lines  |  [TEXT/KEEN]

  1. #$FilesInOrderTest - a little test to verify that hAWK can deal with
  2. #input files in specific order. It expects to be passed a list of
  3. #full path names for the files in the single actual input file,
  4. #one full path name per line. It reads in this single file, alters
  5. #the array of input file names to contain the list, and then removes
  6. #the single original input file from the list. The result is as though
  7. #the file names were passed along using the "MFS selected files" option
  8. #but in the order you wanted.
  9.  
  10. #To try this out:
  11. #1    Select some files for multi-file operations ("searching")
  12. #2    Run the program $EchoFullPathNames - this will generate a list of
  13. #    full path names for the files you selected, and show the results
  14. #    in the window $tempStdOut
  15. #3    Copy the contents of $tempStdOut to a new window (no need to save it)
  16. #    and alter the sequence of path names by swapping some lines
  17. #4    Leave the new window in front and run this program, taking input
  18. #    from "All of front text". At the end, $tempStdOut will display the
  19. #    same list as your new window. (Note $tempStdOut is automatically
  20. #    refreshed after a run, so there is no need to close it first).
  21.  
  22. #This is the modification to be added to the beginning of any program
  23. #that wants a list of files in specific order to use as input:
  24. BEGIN    {while (getline _specific_file_ < ARGV[1] > 0)
  25.             {
  26.             if (length(_specific_file_) > 1 &&
  27.             index(_specific_file_, ":") > 0)
  28.                 ARGV[ARGC++] = _specific_file_;
  29.             }
  30.         close(ARGV[1]);
  31.         ARGV[1] = "";
  32.         }
  33. #end modification
  34.  
  35. #Read the files in as input, but just print out the filenames in
  36. #the order encountered.
  37. FNR == 1    {print FILENAME }